package it.koutifaris.travianmap.view.serversettingsview;

import it.koutifaris.travianmap.dal.TravianServerSettingsService.TravianServerSettings;

import java.util.Observable;

class ServerViewModel extends Observable implements TravianServerSettings {

	private String server;
	private boolean wifiOnly;
	private boolean autoUpdate;

	public ServerViewModel(String server, boolean wifiOnly, boolean autoupdate) {
		this.server = server;
		this.wifiOnly = wifiOnly;
		this.autoUpdate = autoupdate;
	}

	@Override
	public String getServer() {
		return server;
	}

	@Override
	public boolean isAutoUpdate() {
		return autoUpdate;
	}

	@Override
	public boolean isWifiOnly() {
		return wifiOnly;
	}

	void setServer(String server) {
		this.server = server;
		setChanged();
	}

	void setAutoUpdate(boolean autoUpdate) {
		this.autoUpdate = autoUpdate;
		setChanged();
	}

	void setWifiOnly(boolean wifiOnly) {
		this.wifiOnly = wifiOnly;
		setChanged();
	}

	@Override
	public String toString() {
		return "{" + server + ": '" + server + "', autoUpdate: " + autoUpdate + ", wifiOnly: " + wifiOnly + "}";
	}

}
